<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1, user-scalable=no" />
    <title>检测支付</title>
    <link rel="stylesheet" href="css/index.css">
    <script src="js/rem_main.js"></script>
    <script src="js/fontnormal.js"></script>
</head>
<body>
<div class="wrapper pay">
    <div class="pay-main">
        <p class="p1">¥<b>199</b></p>
        <p class="p2">此费用将用于您的采集<br/>和系统生成检测报告</p>
    </div>
    <div class="pay-btn">
        <button onclick="callpay()">立即支付</button>
    </div>
</div>
<script type="text/javascript">
    //调用微信JS api 支付
    function jsApiCall()
    {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest',
            <?php echo $data['jsApiParameters']; ?>,
            function(res){
                WeixinJSBridge.log(res.err_msg);
                if(res.err_msg == "get_brand_wcpay_request:ok" ){
                    // 使用以上方式判断前端返回,微信团队郑重提示：
                    //res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。
                    location.href="/home/checkjcsuccess";
                }
            }
        );
    }

    function callpay()
    {
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        }else{
            jsApiCall();
        }
    }
</script>

</body>
</html>